From db7726c5bf4e2ae557163cf2db7aaadf90762837 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 31 Aug 2019 01:32:03 +0200 Subject: [PATCH] avatar: Use Property bindings to sync reactivity Instead of manually updating properties on change, use native properties bindings to keep the them synchronized. Disable hover-tracking and focus-ability when the avatar is not sensitive. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559 --- js/ui/userWidget.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js index 5cd4bb36d..9dcc60f40 100644 --- a/js/ui/userWidget.js +++ b/js/ui/userWidget.js @@ -25,7 +25,6 @@ var Avatar = GObject.registerClass({ super._init({ style_class: params.styleClass, - track_hover: params.reactive, reactive: params.reactive, width: params.iconSize * themeContext.scaleFactor, height: params.iconSize * themeContext.scaleFactor @@ -34,6 +33,11 @@ var Avatar = GObject.registerClass({ this._iconSize = params.iconSize; this._user = user; + this.bind_property('reactive', this, 'track-hover', + GObject.BindingFlags.SYNC_CREATE); + this.bind_property('reactive', this, 'can-focus', + GObject.BindingFlags.SYNC_CREATE); + // Monitor the scaling factor to make sure we recreate the avatar when needed. this._scaleFactorChangeId = themeContext.connect('notify::scale-factor', this.update.bind(this)); @@ -50,7 +54,6 @@ var Avatar = GObject.registerClass({ } setSensitive(sensitive) { - this.can_focus = sensitive; this.reactive = sensitive; } -- 2.39.5